package com.android.support.lib.universal.general;

import java.util.HashMap;
import java.util.Map;

/**
 * 使用说明 Session session = Session.getSession(); session.put("name", value);
 * session.get("name");
 * 
 * @author 彭治铭
 *
 */
public class Session {
	@SuppressWarnings("unchecked")
	private Map _objectContainer;

	private static Session session;

	@SuppressWarnings("unchecked")
	private Session() {

		_objectContainer = new HashMap();

	}

	public static Session getSession() {

		if (session == null) {

			session = new Session();

			return session;

		} else {

			return session;

		}
	}

	@SuppressWarnings("unchecked")
	public void put(Object key, Object value) {

		_objectContainer.put(key, value);

	}

	public Object get(Object key) {

		return _objectContainer.get(key);

	}

	public void cleanUpSession() {

		_objectContainer.clear();

	}

	public void remove(Object key) {

		_objectContainer.remove(key);

	}

}
